//#include "StdAfx.h"
#include "BasicHideWindow.h"

namespace utility
{

#define WPARAM_NULL			0
#define WPARAM_INSERT		1
#define WPARAM_REMOVE		2

	BasicHideWindow::BasicHideWindow(void)
	{
		m_pfnCallBack = NULL;
	}

	BasicHideWindow::~BasicHideWindow(void)
	{
	}

	LRESULT BasicHideWindow::OnTimer( UINT uMessage, WPARAM wParam, LPARAM lParam, BOOL &bHandled )
	{
		if( wParam == START_USBDETECT_TIMER_ID)
		{
			//m_usbDetect.SetMainhWnd(m_hWnd);
			//m_usbDetect.StartUsbDetect();
			::KillTimer(m_hWnd,START_USBDETECT_TIMER_ID);
		}
		return 0;
	}

	LRESULT BasicHideWindow::OnDestroy( UINT uMessage, WPARAM wParam, LPARAM lParam, BOOL &bHandled )
	{
		//m_usbDetect.StopUsbDetect();
		PostQuitMessage(1);
		return 0;
	}

	LRESULT BasicHideWindow::OnDevChangeMsg(UINT uMessage, WPARAM wParam, LPARAM lParam, BOOL &bHandled)
	{
		//m_usbDetect.OnDeviceChangeMessage(wParam,lParam);
		return 0;
	}

	LRESULT BasicHideWindow::OnAndroidDevChange(UINT uMessage, WPARAM wParam, LPARAM lParam, BOOL &bHandled)
	{
		if(m_pfnCallBack)
		{
			int nFlag = -1;
			nFlag = (wParam==WPARAM_INSERT)?0:(wParam==WPARAM_REMOVE)?1:nFlag;
			m_pfnCallBack(nFlag);
		}
		return 0;
	}

	void BasicHideWindow::SetCallBack( pfnBasicHideWindowCallback pfnCallBack )
	{
		m_pfnCallBack = pfnCallBack;
	}

}
